{extend name="common/common" /}

{block name="content"}
	<div class="ibox-title">
	    <h5>电子商务进农村综合示范进展情况列表</h5>
	</div>
	<div class="ibox-content">
		<div id="table-box">
			<el-form :inline="true" class="search-table-form">
				<el-form-item>
					<el-select v-model="sea.seaDepart" placeholder="请选择地区">
						{volist name="departs" id="v"}
						<el-option label="{$v.name}" value="{$v.id}"></el-option>
						{/volist}
					</el-select>
				</el-form-item>
				<el-form-item>
					<el-input
						placeholder="请输入承办单位"
						clearable="true"
						v-model="sea.seaEnterName">
					</el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="info" plain @click="getTable">查询</el-button>
				</el-form-item>
			</el-form>
			<el-table :data="tableData" stripe="true" border>
				<el-table-column align="center" prop="id" sortable width="80"
					label="序号">
				</el-table-column>
				<el-table-column align="center" prop="depart_name" label="填报单位"></el-table-column>
				<el-table-column align="center" prop="enter_name" label="企业名称"></el-table-column>
				<el-table-column align="center" prop="link_man" label="填报人"></el-table-column>
				<el-table-column align="center" prop="link_type" label="联系电话"></el-table-column>
				<el-table-column align="center" prop="is_commit" label="是否提交">
					<template slot-scope="scope">
						<el-tag
							:type="scope.row.is_commit == '1' ? 'success' : 'danger'"
          					disable-transitions>{{scope.row.is_commit_name}}</el-tag>
      					</template>
				</el-table-column>
				<el-table-column align="center" prop="operate" label="操作" width="200">
					<template slot-scope="scope">
						{if authCheck('tablequery/companylistedit')}
						<el-tooltip content="编辑" open-delay="500" hide-after="1500" placement="bottom">
						<el-button
							@click="editRow(scope.row)"
							size="mini" plain type="success"
							icon="el-icon-edit">
						</el-button>
						</el-tooltip>
						{/if}
						{if authCheck('tablequery/companylistdel')}
						<el-tooltip content="删除" open-delay="500" hide-after="1500" placement="bottom">
						<el-button
							@click="delRow(scope.row)"
							size="mini" plain 	type="danger"
							icon="el-icon-delete">
						</el-button>
						</el-tooltip>
						{/if}
					</template>
				</el-table-column>
			</el-table>
			<div class="table-page">
				<el-pagination
					@size-change="pageSizeChange"
					@current-change="curPageChange"
					:current-page="sea.pageNumber"
					:page-sizes="[10, 20, 50, 75]"
					:page-size="sea.pageSize"
					layout="total, sizes, prev, pager, next, jumper"
					:total="tableTotal">
				</el-pagination>
			</div>
		</div>
	</div>
{/block}

{block name="component"}
<div id="exBox">
<el-dialog title="审核报表" :visible.sync="is_show" tool="15vh">
	<el-form :model="form">
		<el-form-item label="是否通过">
			<el-radio-group v-model="form.examine" size="mini">
				<el-radio-button :label="1">是</el-radio-button>
				<el-radio-button :label="0">否</el-radio-button>
			</el-radio-group>
		</el-form-item>
		<el-form-item label="审核意见">
			<el-input type="textarea" v-model="form.examine_remark" placeholder="审批审核意见"></el-input>
		</el-form-item>
	</el-form>
	<div slot="footer" class="dialog-footer">
		<el-button @click="is_show = false">取消</el-button>
		<el-button type="success" @click="subForm">确定</el-button>
	</div>
</el-dialog>
</div>
<script type="text/javascript">
var exBox = new Vue({
	el:"#exBox",
	data:{
		is_show:false,
		form:{
			id:0,
			examine:0,
			examine_remark:''
		}
	},
	methods:{
		subForm(){
			var param = this.form;
			$.post('{:url("Tablequery/monthExamine")}',param,function(res){
				if(res.code == 1){
					exBox.is_show = false;
					main.$notify({
						title:"成功",type:"success",
						message:res.msg
					});
					main.getTable();
				}else{
					main.$notify.error({
						title:"错误",
						message:res.msg
					})
				}
			})
		}
	}
})
</script>
{/block}

{block name="script"}
<script type="text/javascript">
var main =  new Vue({
	el:"#main",
	data() {
		return {
			loading:false,
			sea:{
				seaDepart:"",
				seaEnterName:"",
				pageSize:10,
				pageNumber:1
			},
			tableData:'',
			tableTotal:0
		}
	},
	mounted:function(){
		this.getTable();
	},
	methods:{
		getTable(){
			this.loading=true;
			var param = this.sea;
			$.post('./companyList',param,function(res){
				main.loading=false;
				if(res.code == 1){
					main.$message({
			          message: res.msg,
			          type: 'success'
			        });
					main.tableData = res.data.rows;
					main.tableTotal = res.data.total;
				}else{
					main.$notify.error({
						title: '失败',
						message: res.msg,
					});
				}
			})
		},
		pageSizeChange(val) {
			this.sea.pageSize = val;
			this.getTable();
		},
		curPageChange(val) {
			this.sea.pageNumber = val;
			this.getTable();
		},
		editRow(row){
			window.location.href = "{:url('Tablequery/companyListEdit')}?id="+row.id;
		},
		delRow(row){
			this.$confirm('此操作将永久删除该报表, 是否继续?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(() => {
				$.post('./companyListDel',{
					'id':row.id
				},function(res){
					if(res.code == '1'){
						main.$notify({
							title:"成功",
							type:"success",
							message:res.msg
						});
						main.getTable();
					}else{
						main.$notify.error({
							title:"错误",
							message:res.msg
						})
					}
				})
			}).catch(() => {
				this.$notify.info({
					title: '消息',
					message: '已取消删除'
				});
			});
		},
	}
})
</script>
{/block}
